package pers.ascend.spring.cloud.dalston.service.governance.eureka.consumer.ribbon.hystrix.manage.service.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import pers.ascend.spring.cloud.dalston.service.governance.eureka.consumer.ribbon.hystrix.manage.service.ConsumerService;

/**
 * 说明：
 *
 * @author ascend
 * 2021/3/19 10:08
 */
@Service("consumerService")
public class ConsumerServiceImpl implements ConsumerService {
    protected Logger log = LoggerFactory.getLogger(getClass());

    @Autowired
    private RestTemplate restTemplate;

    @Override
    public String hello(String name) {
        if (log.isInfoEnabled()) {
            log.info("ConsumerServiceImpl.hello()");
        }
        String url = "http://eureka-producer/producer/hello?name=" + name;
        return restTemplate.getForObject(url, String.class);
    }


}
